package sedh.project

import grails.test.*

class ServicoIntTests extends GroovyTestCase {
	
	def serv1, serv2
	
    protected void setUp() {
        super.setUp()
    }

    protected void tearDown() {
        super.tearDown()
    }

    void testcriaESalvaServico() {
		serv1 = new Servico(nome: "Servico1", descricao: "Descricao1").save()
		serv2 = new Servico(nome: "Servico2", descricao: "Descricao2").save()
		
		assertNotNull(serv1)
		assertNotNull(serv2)
		
		assertEquals 2, Servico.count()
		
    }
	
	void testDeletaTodosServicos() {
		def serv = Servico.getAll()
		
		for (Servico s1 : serv) {
			s1.delete(flush:true)
		}
		
		assertEquals 0, Servico.count()
	}
}

